home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / idcutils.zip / DTROFF.ASM < prev    next >
Assembly Source File  |  1988-05-27  |  2KB  |  70 lines

  1.  
  2. ; Program    : DTROFF.ASM
  3. ; Author    : Gary Conway, Infinity Design Concepts, Inc.
  4. ; Created    : 5/27/88
  5. ; Format    : COM file
  6.  
  7. ; This program accepts a command line argument that is the COM port number
  8. ; The DTR line will be dropped for this com port.
  9. ; If no command line argument is given, then no action is taken
  10. ; usage:   DTROFF 1     -- this would drop DTR on port 1
  11.  
  12. Main        Segment
  13.         Assume CS:main,DS:main,DS:main,SS:main
  14.         Org    100h
  15.                 
  16. Start:        Cld
  17.         Mov    CX,80        ; max search length
  18.         Mov    SI,82h        ; command line parms start here
  19. FindCmd:    Dec    CX        ; decr counter
  20.         Jcxz    Exit        ; nothing found
  21.         Lodsb            ; get command line argument
  22.         Cmp    AL,13        ; end of string ?
  23.         Jz    Exit        ; yeah, get outta here
  24.         Cmp    AL," "        ; skip blanks
  25.         Jz    FindCmd
  26.         
  27.         Sub    AL,"1"        ; make it binary
  28.         Cbw            ; make it a word
  29.         Mov    [ComPort],AX    ; save it
  30.         Call    GetBase        ; calculate base address of comport
  31.         Call    Comoff        ; drop DTR
  32. Exit:        Mov    AX,4C00h
  33.         Int    21h        ; exit to DOS
  34.     
  35. ComOFF        Proc
  36.         Mov    DX,[BaseAddress]
  37.         Add    DX,4        ; point to modem control register
  38.         Mov    AL,0        ; clear DTR and DSR
  39.         Out    DX,AL
  40.         Ret        
  41. ComOFF        Endp
  42.  
  43.  
  44. GetBase        Proc
  45.         Mov    DI,[ComPort]    ; 0 = COM 1, 1 = COM 2
  46.         Add    DI,DI
  47.         Push    ES
  48.         Mov    AX,40h        ; BIOS com segment
  49.         Mov    ES,AX
  50.         Mov    DX,ES:[DI]
  51.         Pop    ES
  52.         Mov    [BaseAddress],DX
  53.         Ret
  54. GetBase        Endp
  55.  
  56. ; turn DTR on, on the modem
  57.  
  58. DTR_ON        Proc
  59.         Mov    DX,[BaseAddress]
  60.         Add    DX,4        ; point to modem control reg.
  61.         Mov    AL,1        ; turn on bit 1 (DTR)
  62.         Out    DX,AL
  63.         Ret
  64. DTR_ON        Endp
  65.  
  66. ComPort        DW    0
  67. BaseAddress    DW    0
  68. Main        Ends
  69.         End    Start
  70.